Leaky abstraction

A leaky abstraction is any implemented abstraction, intended to reduce (or hide) complexity, where the underlying details are not completely hidden. The term is most frequently used to call attention to a flaw in a software or hardware abstraction.

Contents

History

The term "leaky abstraction" appears to have been coined in 2002 by Joel Spolsky.[1] However, an earlier paper by Kiczales clearly describes some of the issues with imperfect abstractions and presents a potential solution to the problem by allowing for the customization of the abstraction itself.[2]

The Law of Leaky Abstractions

As coined by Spolsky, the Law of Leaky Abstractions states "All non-trivial abstractions, to some degree, are leaky." In making this statement, Spolsky highlights a particularly problematic cause of software defects: the reliance of the software developer on the infallibility of an abstraction.

In Spolsky's article, he calls attention to many examples of abstractions that work most of the time, but where a detail of the underlying complexity cannot be ignored, and thus drives complexity into the software that was supposed to be simplified by the abstraction itself.

Effect on software development

As the systems we use become more and more complex, the number of abstractions that software developers must rely upon increases. Each abstraction attempts to hide complexity, allowing a software developer to create code that can "handle" all the variations in complexity that modern computing requires.

However, if Spolsky's Law of Leaky Abstractions is true, then in order to create software that is reliable, software developers must learn many of the abstraction's underlying details anyway.

Examples

Spolsky cites numerous examples of leaky abstractions that create problems for software development. The following examples are provided in his paper:

See also

References

  1. ^ Spolsky, Joel (2002). "The Law of Leaky Abstractions". http://www.joelonsoftware.com/articles/LeakyAbstractions.html. Retrieved 2010-09-22.  - a Blog post by Spolsky that asserts that all non-trivial abstractions are 'leaky' and therefore problematic.
  2. ^ Kiczales, Gregor (1992). "Towards a New Model of Abstraction in the Engineering of Software". http://www2.parc.com/csl/groups/sda/publications/papers/Kiczales-IMSA92/for-web.pdf. Retrieved 2010-02-03.  - a paper by Gregor Kiczales that describes the problem of imperfect abstractions and suggests a programming model for coping with them.